@include('admin.public.head')
<div class="wrapper wrapper-content animated fadeInRight">
  <div class="row">
    <div class="col-sm-12">
      <div class="ibox float-e-margins">
        <div class="ibox-title">
          <h5>
            个人资料
          </h5>
        </div>
        <div class="ibox-content">
          <form method="post" class="m-t form-horizontal">

            <div class="form-group">
              <label class="col-sm-2 control-label">账号</label>
              <div class="col-sm-10">
                <input type="text" name="account" class="form-control" value="{{$account->account??''}}" disabled>
              </div>
            </div>
            <div class="hr-line-dashed"></div>

            <div class="form-group">
              <label class="col-sm-2 control-label">密码</label>
              <div class="col-sm-10">
                <input type="password" class="form-control" name="password" value="">
              </div>
            </div>
            <div class="hr-line-dashed"></div>

            <div class="form-group">
              <label class="col-sm-2 control-label">确认密码</label>
              <div class="col-sm-10">
                <input type="password" class="form-control" name="config_password" value="">
              </div>
            </div>
            <div class="hr-line-dashed"></div>

            <div class="form-group">
              <div class="col-sm-4 col-sm-offset-2">
              <button class="btn btn-primary">保存</button>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
<script>
    $(".m-t").submit(function(e){
        var password = $("input[name='password']").val();
  	    var config_password = $("input[name='config_password']").val();

        if(password != config_password){
            layer.msg('密码不一致!');
            return false;
        }

        $.ajax({
            url:"/update_password",    //请求的url地址
            dataType:"json",   //返回格式为json
            data:{"pwd":password},    //参数值
            type:"POST",   //请求方式
            success:function(req){
                //请求成功时处理
                if(req.status == 0){
                    layer.msg(req.message);
                    return false;
                }

                layer.msg('修改成功！');
            }
        });

        return false;
    });
</script>
</body>
</html>
